package com.timofeyco.springsocialwithscribedemo.web.controllers;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.portlet.ModelAndView;

@Controller
public class MainController {
    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String main() {
        return "index";
    }

    @RequestMapping(value = "/profile", method = RequestMethod.GET)
    public String profile(
            @RequestParam(value = "service", required = false) String service,
            @RequestParam(value = "id", required = false) String id,
            @RequestParam(value = "nick", required = false) String nick,
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "photo", required = false) String photo,
            Model model) {
        model.addAttribute("service", service);
        model.addAttribute("id", id);
        model.addAttribute("nick", nick);
        model.addAttribute("name", name);
        model.addAttribute("photo", photo);
        return "profile";
    }
}
